<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/6/27
  Time: 12:29
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <base href="<%=basePath%>">

    <title>欢迎</title>

    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
        <link rel="stylesheet" type="text/css" href="styles.css">
        -->

</head>

<body>
<div class="_faqs9oi87" id="question">

    <!-- Single -->
    <c:forEach items="${qlist}" var="q">
        <div class="_sin98ufaq">
            <h4>${q.qtext}<span style="float: right">
                <c:set var="flag" scope="page" value="1"/>
                                    <c:if test="${clist!=null}">
                                        <c:forEach items="${clist}" var="c">
                                            <c:if test="${q.qid==c.qid.qid && user.uid==c.uid.uid}">
                                                <c:set var="flag" scope="page" value="2"/>
                                                已收藏
                                            </c:if>
                                        </c:forEach>
                                    </c:if>
                                    <c:if test="${clist!=null}">
                                        <c:forEach items="${clist}" var="c">
                                            <c:if test="${flag==1}">
                                                <c:set var="flag" scope="page" value="2"/>
                                                <c:if test="${q.qid!=c.qid.qid || user.uid!=c.uid.uid}">
                                                    <a href="faq/collect/${q.qid}/1">收藏</a>
                                                </c:if>
                                            </c:if>
                                        </c:forEach>
                                    </c:if>
                                     <c:if test="${flag==1}">
                                            <c:set var="flag" scope="page" value="2"/>
                                    <c:if test="${user!=null}">
                                        <a href="faq/collect/${q.qid}/1">收藏</a>
                                    </c:if></c:if>
                <a id="${q.qid-44444}" href="javascript:void(0)" displayname="${q.qid-99999}" displayname2="${q.qid-33333}" onclick="showAnswer(this)" hidden="hidden">显示</a>
                                    <a id="${q.qid-33333}" href="javascript:void(0)" displayname="${q.qid-99999}" displayname2="${q.qid-44444}" onclick="hiddenAnswer(this)">隐藏</a></span></h4>
            <h4 align="right">语言：${q.sid.sname}。提问人：${q.uid.uname}</h4>
            <c:if test="${q.uid.uid == user.uid && user.uid != 1}">
                <a href="javascript:void(0);" style="color: red;float:right;" class="liks light-dark" displayname="${q.qid}" onclick="deleteReview(this)">删除问题</a>
            </c:if>
            <c:if test="${user.uid==1}"><!-- 判断是否为管理员账号 -->
                <a href="javascript:void(0);" style="color: red;float:right;" class="liks light-dark" displayname="${q.qid}" onclick="deleteReview(this)">删除问题</a>
            </c:if>
            <div id="${q.qid-99999}">
            <c:forEach items="${alist}" var="a">
                <c:if test="${q.qid==a.qid}">
                    <p>${a.ttext}</p><span style="float: right">回答人：${a.uid.uname}。时间：${a.tsend}。
                    <c:if test="${q.uid.uid == user.uid && user.uid != 1}">
                    <a href="javascript:void(0);" style="color: red" class="liks light-dark" displayname="${a.tid}" onclick="deleteAnswer(this)">删除回答</a>
                </c:if>
                <c:if test="${user.uid==1}"><!-- 判断是否为管理员账号 -->
                    <a href="javascript:void(0);" style="color: red" class="liks light-dark" displayname="${a.tid}" onclick="deleteAnswer(this)">删除回答</a>
                </c:if>
                </span>

                </c:if>
            </c:forEach>
            </div>
            <br/>
            <div style="float: right"><a href="javascript:void(0);" style="color: red"
                                         class="liks light-dark" displayname="${q.qid}" onclick="showReview(this)">回答问题/评论</a></div>
            <div id="${q.qid}" hidden="hidden">
                <form action="faq/answerQuestion" method="post">
                        <%--                                        <textarea rows="6" cols="60" placeholder="请输入您的答案" id="${q.qid}" name="text"/>--%>
                    <input type="text" id="${q.qid}" name="text" style="width: 860px;height: 400px"/>
                    <input type="hidden" name="qid" value="${q.qid}"/>
                    <br/>
                    <input type="submit" value="确定提交">
                </form>
            </div>
        </div>
    </c:forEach>

</div>

</body>
</html>